<html>
	<head>
		<meta charset="utf-8" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<script type="text/javascript" src="js/index.js"></script>
		<title>动物管理系统</title>
	</head>
	<body>
		<h1>动物管理系统</h1>
		<table>
			
			<tr>
				<td>名称：</td>
				<td>
					<input type="text" name="name">
				</td>
			</tr>
			<tr>
				<td>科属：</td>
				<td>
					<input type="text" name="ks">
				</td>
			</tr>
			<tr>
				<td>品种：</td>
				<td>
					<input type="text" name="pz">
				</td>
			</tr>
			<tr>
				<td>是否珍惜：</td>
				<td>
					<input type="text" name="sfzx">
				</td>
			</tr>
			<tr>
				<td colspan="4">
					<button onclick="insert()">添加</button>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
			function insert(){
				let name=document.getElementsByName("name")[0].value;
				let ks=document.getElementsByName("ks")[0].value;
				let pz=document.getElementsByName("pz")[0].value;
				let sfzx=document.getElementsByName("sfzx")[0].value;
				let ajax=getAjax();
				ajax.open("POST","./server/insert_server.php", false);
				ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8");
				ajax.send("name="+name+"&ks="+ks+"&pz="+pz+"&sfzx="+sfzx);
				alert(ajax.responseText);
				window.location.href="index.php";
			}
		</script>
	</body>
</html>